#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "serialworks.h"
#include <QTimer>
#include "server.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

    enum M_WorkMode {
        Port_TcpS,
        Port_TcpC,
        Port_Udp,
        Port_Com
    };
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void showEdit(QString str);
public slots:
    void slot_fresh_com();
    void slot_show_recv_com_data(QByteArray);
    void slot_show_box();
    void slot_send_every();
    void slot_start_timer(bool chk);
    void slot_curr_index_change(int index);

    void slot_server_recv_data(QString ip,QByteArray bytes);
    void slot_server_socket_change(QString ip,bool isconn);

private slots:
    void on_btn_clearWin_clicked();

    void on_btn_clearSend_clicked();

    void on_btn_openCom_clicked();

    void on_btn_more_clicked();

    void on_btnSend_clicked();

    void on_btn_conn_clicked();

    void on_btn_discon_clicked();

private:
    Ui::MainWindow *ui;
    Serialworks *m_works;
    bool  m_isopen;
    int m_parity;
    QTimer  *m_timer;
    Server *m_server;
    M_WorkMode m_mode;



};

#endif // MAINWINDOW_H
